package com.qf.sl.youshare.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.qf.sl.youshare.R;
import com.qf.sl.youshare.model.UserLogin;
import com.qf.sl.youshare.utils.UserCurrent;

/**
 * Created by IDEA
 * User : SL
 * on  2015/3/6.
 * 21:35
 */
public class SettingActivity extends Activity implements View.OnClickListener {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);

        Button btnExit = (Button) findViewById(R.id.user_exit);
        btnExit.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        UserCurrent userCurrent = UserCurrent.getInstance();
        UserLogin userLogin = userCurrent.getUserLogin();
        if (userLogin != null) {
            userCurrent.setUserLogin(null);
            userCurrent.setUser(null);

            Toast.makeText(this, "成功退出当前用户", Toast.LENGTH_SHORT).show();
            finish();
        }else {
            Toast.makeText(this, "当前没有账户登录", Toast.LENGTH_SHORT).show();
            finish();
        }
    }
}